<template>
  <view class="content">
    <!-- tabArr：tab数组 tabChange：标签栏切换 -->
    <cc-newsTabs :tabArr="tabArr" @tabChange="tabChange"> </cc-newsTabs>
    <view v-if="activetab == 'day'">
      <dayOrder></dayOrder>
    </view>
    <view v-else-if="activetab == 'month'"> 
      <monthOrder></monthOrder>
    </view>
  </view>
</template>

<script>
import dayOrder from "./dayOrder.vue";
import monthOrder from "./monthOrder.vue";
export default {
  components: {
    dayOrder,
    monthOrder,
  },
  data() {
    return {
      activetab: "day",
      tabArr: [
        {
          name: "日账单",
          id: "1",
        },
        {
          name: "月账单",
          id: "2",
        },
      ],
    };
  },

  methods: {
    tabChange(currentIndex) {
      if (currentIndex == 0) {
        this.activetab = "day";
      } else {
        this.activetab = "month";
      }
    },
  },
};
</script>

<style></style>
